package net.kts.attraction.subway.adapter;

import java.util.List;

import net.kts.main.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class AttractionAddressAdapter extends ArrayAdapter<String> {

	public AttractionAddressAdapter(Context context, int textViewResourceId,
			List<String> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		View v = convertView;
		
		 if (v == null) {
	            LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	            v = vi.inflate(R.layout.attraction_address_row, null);
	        }
		
		
		String str = getItem(position);
		
		int iGubun = str.indexOf("||");
		
		String title = str.substring(0, iGubun);
		String trans = str.substring(iGubun+2);
		
		
		TextView titleTextView = (TextView)v.findViewById(R.id.address_title);
		TextView transTextView = (TextView)v.findViewById(R.id.address_trans);
		titleTextView.setText(title);
		transTextView.setText(trans);
		
		
		return v;
	}
	
//	private TextView settingTextView(String str) {
//		
//		TextView textView = new TextView(getContext());
//		textView.setText(str);
//		textView.setBackgroundResource(R.drawable.list_shape_background_grey);
//		
//		textView.setTextSize(16);
//		//textView.getLayoutParams().height = 100;
//		
//		return textView;
//		
//	}
	

}
